package com.ukao.cashregister.adapter;

import android.content.Context;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.OrdersList;
import com.ukao.cashregister.utils.CheckUtils;
import com.ukao.cashregister.utils.MyDateUtils;

import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class OrderListAdapter extends CommonAdapter<OrdersList.PageInfoBean.ListBean> {



    public OrderListAdapter(Context context, List<OrdersList.PageInfoBean.ListBean> datas) {
        super(context, datas, R.layout.orders_list_item);
    }



    @Override
    public void convert(ViewHolder viewHolder, OrdersList.PageInfoBean.ListBean item) {

        viewHolder.setText(R.id.orders_list_no,"单号："+item.getOrderNo());
        viewHolder.setText(R.id.orders_list_date,"下单时间："+MyDateUtils.formatDataTime(item.getCreateTime()));
        viewHolder.setText(R.id.orders_list_arrive_status,CheckUtils.isEmptyString(item.getStatusText()));
        viewHolder.setText(R.id.orders_list_total,"数量："+item.getProductCnt()+"件");
       // viewHolder.setText(R.id.orders_list_arrive_total,item.getProductReceiveCnt()>0?item.getProductReceiveCnt()+"件":"");
        viewHolder.setText(R.id.orders_list_amount," 支付金额："+CheckUtils.isEmptyNumber(item.getPayablePrice())+"元");
        viewHolder.setText(R.id.orders_list_pay_status,item.getPayStatusText());
       // viewHolder.setText(R.id.orders_list_arrive_total_title,item.getStatusText()+"：");
        if(item.getProductReceiveCnt()>0){
         //   viewHolder.setTextColorRes(R.id.orders_list_arrive_total_title,R.color.green);
         //   viewHolder.setTextColorRes(R.id.orders_list_arrive_total,R.color.green);
        }else{
          //  viewHolder.setTextColorRes(R.id.orders_list_arrive_total_title,R.color.black);
           // viewHolder.setTextColorRes(R.id.orders_list_arrive_total,R.color.black);
        }
     /*payStatus0	未支付1	已支付*/
        switch (  item.getPayStatus()){
            case 0:

                viewHolder.setTextColorRes(R.id.orders_list_pay_status,R.color.warm_red);
                break;
            case 1:
                viewHolder.setTextColorRes(R.id.orders_list_pay_status,R.color.green);


                break;
        }



    }








}
